<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Http\Requests\UserContext;
use App\Http\Services\GoodsService;
use App\Http\Traits\ResponseJson;

class GoodsController extends Controller
{
    use ResponseJson;

    protected $goodsService;

    public function __construct(GoodsService $goodsService)
    {
        $this->goodsService = $goodsService;
    }

    public function lists(UserContext $userContext)
    {
        $data = $this->goodsService->lists($userContext);
        return $this->returnJson($data);
    }

    public function detail(UserContext $userContext)
    {
        $data = $this->goodsService->detail($userContext);
        return $this->returnJson($data);
    }

    public function cycle()
    {
        $data = $this->goodsService->cycle();
        return $this->returnJson($data);
    }

}
